package com.tide.crm.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.tide.crm.model.CustomVisitInfo;

@Mapper
public interface CustomVisitInfoDao {

    @Select("select * from custom_visit_info t where t.id = #{id}")
    CustomVisitInfo getById(Long id);

    @Delete("delete from custom_visit_info where id = #{id}")
    int delete(Long id);

    int update(CustomVisitInfo customVisitInfo);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into custom_visit_info(customer_id, visit_msg, creater, create_date, modifyer, modify_date,visit_date) values(#{customerId}, #{visitMsg}, #{creater}, #{createDate}, #{modifyer}, #{modifyDate}, #{visitDate})")
    int save(CustomVisitInfo customVisitInfo);
    
    int count(@Param("params") Map<String, Object> params);

    List<CustomVisitInfo> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
